##
# messages.py - Created by Timothy Morey on 6/10/2012
#
# This file provides a ctypes wrapper for libnvn items defined in messages.h.
#

import ctypes

from libnvn import nvn
import data_schema
import layer

# MessageType enum values
MessageTypeUnknown  = 0
MessageTypeRequest  = 1
MessageTypeResponse = 2

CreateAddLayerRequest = nvn.CreateAddLayerRequest
CreateAddLayerRequest.restype = ctypes.c_int
CreateAddLayerRequest.argtypes = [
                                  layer.LayerProperties,
                                  ctypes.POINTER(ctypes.c_char), 
                                  ctypes.POINTER(ctypes.c_int),
                                 ]

CreateAdjustDisplayRequest = nvn.CreateAdjustDisplayRequest
CreateAdjustDisplayRequest.restype = ctypes.c_int
CreateAdjustDisplayRequest.argtypes = [
                                       ctypes.c_int, 
                                       ctypes.c_int, 
                                       ctypes.c_int, 
                                       ctypes.c_int, 
                                       ctypes.c_int, 
                                       ctypes.POINTER(ctypes.c_char), 
                                       ctypes.POINTER(ctypes.c_int),
                                      ]

CreateCloseDisplayRequest = nvn.CreateCloseDisplayRequest
CreateCloseDisplayRequest.restype = ctypes.c_int
CreateCloseDisplayRequest.argtypes = [
                                      ctypes.POINTER(ctypes.c_char),
                                      ctypes.POINTER(ctypes.c_int),
                                     ]

CreateQueryDataGridSchemaRequest = nvn.CreateQueryDataGridSchemaRequest
CreateQueryDataGridSchemaRequest.restype = ctypes.c_int
CreateQueryDataGridSchemaRequest.argtypes = [
                                             ctypes.c_char_p, 
                                             ctypes.c_char_p, 
                                             ctypes.POINTER(ctypes.c_char), 
                                             ctypes.POINTER(ctypes.c_int),
                                            ]

CreateQueryDataSetSchemaRequest = nvn.CreateQueryDataSetSchemaRequest
CreateQueryDataSetSchemaRequest.restype = ctypes.c_int
CreateQueryDataSetSchemaRequest.argtypes = [
                                            ctypes.c_char_p,
                                            ctypes.POINTER(ctypes.c_char), 
                                            ctypes.POINTER(ctypes.c_int),
                                           ]

CreateSimpleRequest = nvn.CreateSimpleRequest
CreateSimpleRequest.restype = ctypes.c_int
CreateSimpleRequest.argtypes = [
                                ctypes.c_char_p,
                                ctypes.c_char_p,
                                ctypes.POINTER(ctypes.c_char),
                                ctypes.POINTER(ctypes.c_int),
                               ]

CreateStartStreamRequest = nvn.CreateStartStreamRequest
CreateStartStreamRequest.restype = ctypes.c_int
CreateStartStreamRequest.argtypes = [
                                     ctypes.c_int, 
                                     ctypes.c_char_p, 
                                     ctypes.c_char_p,
                                     ctypes.POINTER(ctypes.c_char), 
                                     ctypes.POINTER(ctypes.c_int),
                                    ]

ParseQueryDataGridSchemaResponse = nvn.ParseQueryDataGridSchemaResponse
ParseQueryDataGridSchemaResponse.restype = ctypes.c_int
ParseQueryDataGridSchemaResponse.argtypes = [
                                             ctypes.POINTER(ctypes.c_char), 
                                             ctypes.c_int, 
                                             ctypes.POINTER(data_schema.DataGridSchema),
                                            ]

ParseQueryDataSetSchemaResponse = nvn.ParseQueryDataSetSchemaResponse
ParseQueryDataSetSchemaResponse.restype = ctypes.c_int
ParseQueryDataSetSchemaResponse.argtypes = [
                                            ctypes.POINTER(ctypes.c_char), 
                                            ctypes.c_int, 
                                            ctypes.POINTER(data_schema.DataSetSchema),
                                           ]

ParseSimpleResponse = nvn.ParseSimpleResponse
ParseSimpleResponse.restype = ctypes.c_int
ParseSimpleResponse.argtypes = [ctypes.POINTER(ctypes.c_char), 
                                ctypes.c_int, 
                                ctypes.POINTER(ctypes.c_int), 
                                ctypes.POINTER(ctypes.c_char), 
                                ctypes.c_int, 
                                ctypes.POINTER(ctypes.c_char), 
                                ctypes.c_int,
                               ]
